#ifndef DOWNFALL_H
#define DOWNFALL_H

#include <QMainWindow>

#include <QTimer>
#include"downfallplayer.h"
#include"Defines.h"
#include"downbullet.h"
#include"downmap.h"
#include"downfallenemy.h"
#include"downfallbomb.h"



//#include<ctime>
#include<QFont>
#include<QMessageBox>


namespace Ui {
class DownFall;
}

class DownFall : public QMainWindow
{
    Q_OBJECT

public:
    explicit DownFall(QWidget *parent = nullptr);
    ~DownFall();


    //启动游戏
    void PlayGame();
    //更新游戏中元素坐标
    void UpdatePosition();
    //绘制到屏幕中
    void paintEvent(QPaintEvent*);
    //鼠标移动事件
    void mouseMoveEvent(QMouseEvent *);
    //键盘按键事件
    void keyPressEvent(QKeyEvent *);
    //void keyReleaseEvent(QKeyEvent *);
    //定时器
    QTimer Timer;
    //地图对象
    DownMap map;
    //飞机对象
    DownFallPlayer Player;
    //初始化场景
    void initScene();
    //判断是否有按键
    bool keypressflag=false;
    //判断按键种类
    char keyflag;
    //飞机随按键移动
    //void judgekey();
    //敌机出场
    void EnemyToScene();


    //敌机数组
    DownFallEnemy enemys[ENEMY_NUM];
    //敌机出场间隔纪录
    int recorder;
    //碰撞检测
    void collisionDetection();
    //爆炸数组
    DownFallBomb bombs[BOMB_NUM];
    //飞机爆炸
    DownFallBomb PlayerBomb;

    //分数
    double SCORE=0;
    QFont Font;

private:
    Ui::DownFall *ui;
};

#endif // DOWNFALL_H
